<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2019/12/9
  Time: 16:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>栏目管理</title>
    <link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css">
    <script language="javascript" src="${pageContext.request.contextPath}/js/util.js"></script>
    <script language="javascript" src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js"></script>
    <script>
        $(function () {
           $("select").bind("change", function() {
                var value = $(this).val();
                var url = abc();
                $.get(url,function (data,status) {
                    //清除除RemoveTr类外的行
                    $("#acc tr:not(.RemoveTr)").empty();
                    $(data).each(function(i,item){
                        if(item.newLabels==null){
                            $("#JsonJquery").append(
                                "<td class='td07'>"+item.label_name+"</td>" +
                                "<td class='td07'>"+"    "+"</td>" +
                                "<td class='td07'>"+item.label_content+"</td>" +
                                "<td class='td07'>"+"<a href='../new/columnDelete.action?id="+item.id+"'>删除</a>"+"</td>" +
                                "<td class='td07'>"+"<a href='../new/columnUpdate.action?id="+item.id+"'>修改</a>"+"</td>"
                            )
                        }else{
                            $("#JsonJquery").append(
                                "<td class='td07'>"+item.label_name+"</td>" +
                                "<td class='td07'>"+item.newLabels.label_name+"</td>" +
                                "<td class='td07'>"+item.label_content+"</td>" +
                                "<td class='td07'>"+"<a href='../new/columnDelete.action?id="+item.id+"'>删除</a>"+"</td>" +
                                "<td class='td07'>"+"<a href='../new/columnUpdate.action?id="+item.id+"'>修改</a>"+"</td>"
                            )
                        }
                    });
                });
                function abc() {
                    return "${pageContext.request.contextPath}/new/newLab.action"+"?name="+value;
                }
           });
        });
    </script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td height="25" align="center" valign="bottom" class="td06"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="2%" valign="middle" background="../../images/bg_03.gif">&nbsp;</td>
                    <td width="2%" valign="middle" background="../../images/bg_03.gif"><img src="../../images/main_28.gif" width="9" height="9" align="absmiddle"></td>
                    <td height="30" valign="middle" background="../../images/bg_03.gif"><div align="left"><font color="#FFFFFF">栏目管理</font></div></td>
                </tr>
            </table></td>
        </tr>
    </table>
    <form name="form1" method="post" action="">
        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table01">
            <tr>
                <td colspan="2" class="td_02"><SPAN class=td_title>根据栏目名称查询</SPAN></td>
            </tr>
            <tr>
                <td width="14%" class="td_02">栏目名称</td>
                <td width="86%" class="td_02">
                    <select name="Labelname" class="input" style="width:99% ">
                        <option value="1" selected>--请选择--</option>
                        <c:forEach items="${lists}" var="i">
                            <option value="${i.label_name}">${i.label_name}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
        </table>
        <br>
        <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td class="td_page" align="left">
                    <div align="right">
                        <a href="${pageContext.request.contextPath}/new/newLabelAl.action" class="buttonface02"  name="Submit">添加栏目</a>
                        <%--<input name="Submit" type="submit" class="buttonface02" value="添加栏目" onClick="javascript:windowOpen('../new/newLabelAl.action','','',700,300,'','','')">--%>
                    </div></td>
            </tr>
        </table>
        <table width="95%" border="0" align="center" id="acc" cellpadding="0" cellspacing="0" class="table01" >
            <tr class="RemoveTr">
                <td colspan="5" align="right" class="td07">
                    <img src="../../images/1.gif" width="4" height="5" align="absmiddle"> <a href="${pageContext.request.contextPath}/new/newLabelAll.action?page=1" class="pageTop" >首页</a> 　
                    <img src="../../images/2.gif" width="3" height="5" align="absmiddle"> <a href="${pageContext.request.contextPath}/new/newLabelAll.action?page=${newLabelBasePage.page-1}" class="pageTop">上一页</a> 　
                    <img src="../../images/2-2.gif" width="3" height="5" align="absmiddle"> <a href="${pageContext.request.contextPath}/new/newLabelAll.action?page=${newLabelBasePage.page+1} " class="pageX" >下一页</a> 　
                    <img src="../../images/3.gif" width="4" height="5" align="absmiddle"> <a href="${pageContext.request.contextPath}/new/newLabelAll.action?page=${newLabelBasePage.pageCount}" class="pageX">末页</a> 　　
                    第 <span>${newLabelBasePage.page}</span>  页
                    共 <span>${newLabelBasePage.pageCount}</span>  页
                    <span>${newLabelBasePage.count}</span> 条记录
                </td>
            </tr>
            <tr class="RemoveTr">
                <td width="17%" class="td_top">栏目名称</td>
                <td width="15%" class="td_top">上级栏目名称</td>
                <td width="44%" class="td_top">栏目描述</td>
                <td width="12%" class="td_top">删除</td>
                <td width="12%" class="td_top">修改</td>
            </tr>
            <c:forEach items="${newLabelBasePage.newLabelss}" var="i" >
                <tr id="JsonJquery">
                    <td class="td07">${i.label_name}</td>
                    <td class="td07">${i.newLabels.label_name}</td>
                    <td class="td07">${i.label_content}</td>
                    <td class="td07"><a href="${pageContext.request.contextPath}/new/columnDelete.action?id=${i.ID}" >删除</a></td>
                    <td class="td07"><a href="${pageContext.request.contextPath}/new/columnUpdate.action?id=${i.ID}" >修改</a></td>
                </tr>
            </c:forEach>
        </table>
        <p>&nbsp;</p>
    </form>
</center>
</body>
</html>
